package cn.zz.veggie.model.query;

import java.util.Objects;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import cn.zz.comm.core.types.query.CommQuery;
import cn.zz.comm.mybaits.types.BaseQuery;
import cn.zz.veggie.model.domain.Settle;
import lombok.Getter;
import lombok.Setter;

/**
 * 结算明细-企业统计(Settle)查询器
 *
 * @author zhongq
 * @since 2024-06-03 23:40:35
 */
@Getter
@Setter
public class SettleQuery extends CommQuery<Integer> implements BaseQuery<Settle> {
	public Integer shopId;
	public Long statTime;
	public Long statTimeStart;
	public Long statTimeEnd;

	public static SettleQuery of(Long statTime) {
		final SettleQuery query = new SettleQuery();
		query.statTime = statTime;
		return query;
	}

	@Override
	public void injectCondition(LambdaQueryWrapper<Settle> queryWrapper) {
		queryWrapper.eq(Objects.nonNull(id), Settle::getId, id);
		queryWrapper.in(Objects.nonNull(ids), Settle::getId, ids);
		queryWrapper.eq(Objects.nonNull(shopId), Settle::getShopId, shopId);
		queryWrapper.eq(Objects.nonNull(statTime), Settle::getStatTime, statTime);
		queryWrapper.ge(Objects.nonNull(statTimeStart), Settle::getStatTime, statTimeStart);
		queryWrapper.lt(Objects.nonNull(statTimeEnd), Settle::getStatTime, statTimeEnd);
	}
}